<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:sec="http://www.springframework.org/security/facelets/tags"
	xmlns:p="http://primefaces.org/ui" lang="en" class="no-js">

<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6 lt8"> <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7 lt8"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8 lt8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<!--<![endif]-->
<h:head>
	<meta charset="UTF-8" />
	<!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  -->
	<title>Login and Registration Form with HTML5 and CSS3</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta name="description" content="" />
	<meta name="keywords"
		content="html5, css3, form, switch, animation, :target, pseudo-class" />
	<meta name="author" content="" />
	<link rel="shortcut icon" href="../favicon.ico" />
	<link rel="stylesheet" type="text/css" href="css/demo.css" />
	<link rel="stylesheet" type="text/css" href="css/style3.css" />
	<link rel="stylesheet" type="text/css" href="css/animate-custom.css" />
	<script type="text/javascript">
		function msg(){
			alert("Nenhum cadastro foi salvo.");
		}
		
		function formatar(src, mask){
			  var i = src.value.length;
			  var saida = mask.substring(0,1);
			  var texto = mask.substring(i)
			if (texto.substring(0,1) != saida)
			  {
			    src.value += texto.substring(0,1);
			  }
		}
		
	</script>
</h:head>
<h:body>
	<div class="container">
		<!-- Codrops top bar -->
		<div class="codrops-top">
			<a href=""> <strong>Home: </strong>Voltar para Home
			</a> <span class="right"> <a
				href=" http://tympanus.net/codrops/2012/03/27/login-and-registration-form-with-html5-and-css3/">
					<strong>Área restrita para estabelecimento</strong>
			</a>
			</span>
			<div class="clr"></div>
		</div>
		<!--/ Codrops top bar -->
		<header> </header>
		<section>
			<div id="container_demo">
				<!-- hidden anchor to stop jump http://www.css3create.com/Astuce-Empecher-le-scroll-avec-l-utilisation-de-target#wrap4  -->


					<div id="wrapper">

					<div id="login" class="animate form">
						<h:form name="form1">
							<h1>Pre Cadastro de Estabelecimento</h1>
							<p:messages showDetail="true" showSummary="false" />
							<p>
								<label for="nome" class="uname" data-icon="u"> Nome</label>
								<h:inputText id="nome" name="name" 
									value="#{estabelecimentoMB.entity.nome}">
									<f:validateLength minimum="3" maximum="50" />
								</h:inputText>
							</p>
							<p>
								<label for="email" class="youmail" data-icon="e"> EMAIL</label>
								<h:inputText id="email" name="n_email" 
									value="#{estabelecimentoMB.entity.email}" />
							</p>
							<p>
								<label for="cnpj" class="uname" data-icon="u"> CNPJ</label>
								<h:inputText id="cnpj" name="n_cnpj" 
									value="#{estabelecimentoMB.entity.cnpj}"
									rendered="#{estabelecimentoMB.entity.id!=0}"
									title="Este campo nÃ£o pode ser alterado"  />
								<h:inputText id="cnpj-edit" name="e_cnpj"
									value="#{estabelecimentoMB.entity.cnpj}"
									rendered="#{estabelecimentoMB.entity.id==0}" onKeyPress="javascript:MascaraCNPJ(form1.cnpj)"  
									maxlength="18" />
							</p>
							<p>
								<label for="entrega" class="uname" data-icon="u">Possui Entrega</label>
								<p:selectOneMenu id="entrega" value="#{estabelecimentoMB.entity.sePossuiEntrega}" height="80" style="width:100px;" >
									<f:selectItem itemLabel="Sim" itemValue="S" />
									<f:selectItem itemLabel="Não" itemValue="N" />
								</p:selectOneMenu>
							</p>
							<p>
								<label for="user" class="uname" data-icon="u">Nome de Usuário</label>
								<h:inputText id="user" name="n_user" 
									value="#{estabelecimentoMB.usuario.login}"
									rendered="#{estabelecimentoMB.entity.id!=0}"
									title="Este campo nÃ£o pode ser alterado" />
								<h:inputText id="user-edit" name="e_user" 
									value="#{estabelecimentoMB.usuario.login}"
									rendered="#{estabelecimentoMB.entity.id==0}" />
							</p>
							<p class="login button">
								<h:commandButton value="Confirmar" action="#{estabelecimentoMB.save}" />
								<h:commandButton value="Cancelar" action="principal.jsf" onclick="javascript:msg()" 
									rendered="#{estabelecimentoMB.entity.id==0}"/>
								<h:commandButton  value="Cancelar"
								rendered="#{estabelecimentoMB.entity.id!=0}"
								action="#{estabelecimentoMB.cancelar}" ajax="false" />
								<h:commandButton value="Voltar" action="principal.jsf"/>
								
								
							</p>
							<p class="change_link">
							</p>
						</h:form>
					</div>
				</div>
			</div>
		</section>
	</div>
</h:body>
</html>